<template>
  <div class="quote">
    <div class="quoteTop">
      <h4 class="var_bgColor">团队、级别</h4>

      <div class="query">
        <Row>

          <Col span="6" v-if="dir['partnerCom'] != 3">
          <label>营业部</label>
          <Select size="small" v-model="info.partnerId" style="width: 50%">
            <Option v-for="item in partnerComList" v-bind:value="item.id" v-text="item.partnerName"></Option>
          </Select>
          </Col>

          <Col span="6">
          <label>团队</label>
          <Select filterable size="small" v-model="info.teamId" style="width: 50%">
            <Option v-for="item in teamInfo" v-bind:value="item.id" v-text="item.teamName"></Option>
          </Select>
          </Col>

          <Col span="6" v-if="id !== '-1'">
          <label>是否团队长</label>
          <Select size="small" v-model="info.isLeader" style="width: 50%" disabled>
            <Option v-for="(item, index) in isLeader" v-bind:value="index" v-text="item"></Option>
          </Select>
          </Col>

          <Col span="6" v-if="info.isLeader === 'Y'">
          <label>是否有出单权限</label>
          <Select size="small" v-model="info.issueAuthoFlag" style="width: 50%">
            <Option v-for="(item,index) in yesOrNo" v-bind:value="item.code" v-text="item.name"></Option>
          </Select>
          </Col>

        </Row>

      </div>
    </div>
  </div>
</template>

<script>

  import api from '../../../utils/api.js'
  import {queryROLE, queryPartnerId, queryPartnerName} from '../../../utils/common.js';
  import reqDic from '../../../utils/requestDictionary.js';

  export default{
    props: {
      info: {
        type: Object,
      },
      teamInfo: {
        type: Object,
      },
      id: {
        type: String
      }
    },
    data: function () {
      return {
        partnerComList: [],

        dir: {
          'partnerCom': '3',
        },

        myRole: '',

        isLeader: reqDic.QueryDictionary("ISLEADER"),
        yesOrNo: reqDic.QueryDictionary("YESORNO"),
      }
    },
    methods: {
      //营业部
      getPartnerComList: function () {
        var self = this;
        api.getPartnerComList().then(res => {
          self.partnerComList = res.body.data;
//          self.allSalemanLevel();
        });
      },
    },
    created: function () {

      this.myRole = queryROLE();

      if (this.myRole == 1) {
        this.dir['partnerCom'] = 1;
        this.getPartnerComList();
      } else {
        this.dir['partnerCom'] = 3;
      }

    }

  }

</script>

